﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MONTRASEC_test.Classes;

namespace MONTRASEC_test.Controls
{
  public partial class wucDVD1Events : System.Web.UI.UserControl
  {
    //copy this part
    public DetailsView dv
    {
      //change the DetailsView field name
      get { return dvD1Events; }
      set { dvD1Events = value; }
    }
    public BulletedList BPleaseFillOtherTemplates
    {
      get { return bPleaseFillOtherTemplates; }
      set { bPleaseFillOtherTemplates = value; }
    }
    public Label LbTotalRecords
    {
      get { return lbTotalRecords; }
      set { lbTotalRecords = value; }
    }
    public Label LDVMode
    {
      get { return lbDVMode; }
      set { lbDVMode = value; }
    }
    //until here
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void dvD1Events_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
      e.Values["D_1_EVENT_RUNAWAYSDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.Values["D_1_EVENT_RUNAWAYSDATE_PERIODOFTHEEVENT"]);

      e.Values["D_1_EVENT_ABDUCTI3RDPERSONDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.Values["D_1_EVENT_ABDUCTI3RDPERSONDATE_PERIODOFTHEEVENT"]);

      e.Values["D_1_EVENT_PARENTALABDUCTDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.Values["D_1_EVENT_PARENTALABDUCTDATE_PERIODOFTHEEVENT"]);

      e.Values["D_1_EVENT_LOSTINFUREDMISSDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.Values["D_1_EVENT_LOSTINFUREDMISSDATE_PERIODOFTHEEVENT"]);

      e.Values["D_1_EVENT_MISSUNACMIGDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.Values["D_1_EVENT_MISSUNACMIGDATE_PERIODOFTHEEVENT"]);
    }

    protected void dvD1Events_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
      e.NewValues["D_1_EVENT_RUNAWAYSDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.NewValues["D_1_EVENT_RUNAWAYSDATE_PERIODOFTHEEVENT"]);

      e.NewValues["D_1_EVENT_ABDUCTI3RDPERSONDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.NewValues["D_1_EVENT_ABDUCTI3RDPERSONDATE_PERIODOFTHEEVENT"]);

      e.NewValues["D_1_EVENT_PARENTALABDUCTDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.NewValues["D_1_EVENT_PARENTALABDUCTDATE_PERIODOFTHEEVENT"]);

      e.NewValues["D_1_EVENT_LOSTINFUREDMISSDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.NewValues["D_1_EVENT_LOSTINFUREDMISSDATE_PERIODOFTHEEVENT"]);

      e.NewValues["D_1_EVENT_MISSUNACMIGDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.NewValues["D_1_EVENT_MISSUNACMIGDATE_PERIODOFTHEEVENT"]);
    }
    protected void detailsView_ModeChanged(object sender, EventArgs e)
    {
      onDetailsView_ModeChanged(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ModeChangedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ModeChangedHandler DetailsView_ModeChanged;

    protected virtual void onDetailsView_ModeChanged(EventArgs e)
    {
      if (DetailsView_ModeChanged != null)
      {
        DetailsView_ModeChanged(this, e);
      }
    }

    protected void detailsView_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)
    {
      onDetailsView_ItemDeleted(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ItemDeletedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ItemDeletedHandler DetailsView_ItemDeleted;

    protected virtual void onDetailsView_ItemDeleted(EventArgs e)
    {
      if (DetailsView_ItemDeleted != null)
      {
        DetailsView_ItemDeleted(this, e);
      }
    }

    protected void detailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
    {
      onDetailsView_ItemInserted(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ItemInsertedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ItemInsertedHandler DetailsView_ItemInserted;

    protected virtual void onDetailsView_ItemInserted(EventArgs e)
    {
      if (DetailsView_ItemInserted != null)
      {
        DetailsView_ItemInserted(this, e);
      }
    }

    protected void detailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
    {

      onDetailsView_ItemUpdated(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ItemUpdatedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ItemUpdatedHandler DetailsView_ItemUpdated;

    protected virtual void onDetailsView_ItemUpdated(EventArgs e)
    {
      if (DetailsView_ItemUpdated != null)
      {
        DetailsView_ItemUpdated(this, e);
      }
    }

        protected void replicateARow(object sender, DetailsViewCommandEventArgs e)
    {
      String myMessage = ""; //message listing the id's that have been updated
      DetailsView dv = (DetailsView)sender;
      int index = int.Parse(e.CommandArgument.ToString());

      String id = (dv.DataKey["ID"]).ToString();

      MONTRASEC_test.Classes.A_NEWENTRY_DataContext dataContext = new MONTRASEC_test.Classes.A_NEWENTRY_DataContext();

      var newEntryToCopy =
          from b in dataContext.GetTable<A_NEWENTRY_>()
          where b.ID == long.Parse(id)
          select b;



      foreach (A_NEWENTRY_ c in newEntryToCopy)
      {
        var recordsToWhichToReplicate =
          from listOfRecordsToReplicate in dataContext.GetTable<A_NEWENTRY_>()
          where listOfRecordsToReplicate.A_NEWENTRY_NEWENTRY_POLICE_CUSTOMSFILEIDENTIF.Equals(c.A_NEWENTRY_NEWENTRY_POLICE_CUSTOMSFILEIDENTIF)
          && listOfRecordsToReplicate.A_NEWENTRY_NEWENTRY_PUBLICPROSECUTORSFILEIDEN.Equals(c.A_NEWENTRY_NEWENTRY_PUBLICPROSECUTORSFILEIDEN)
          && listOfRecordsToReplicate.A_NEWENTRY_NEWENTRY_COURTSFILEIDENTIFICATIONN.Equals(c.A_NEWENTRY_NEWENTRY_COURTSFILEIDENTIFICATIONN)
          && listOfRecordsToReplicate.ID != c.ID
          select listOfRecordsToReplicate;

        foreach (A_NEWENTRY_ recordToWhichToReplicate in recordsToWhichToReplicate)
        {
                  recordToWhichToReplicate.D_1_Event_DIGEST = c.D_1_Event_DIGEST;
        recordToWhichToReplicate.D_1_Event_DIGEST_NFP = c.D_1_Event_DIGEST_NFP;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYS_ = c.D_1_EVENT_RUNAWAYS_;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSDATE_PERIODOFTHEEVENT = c.D_1_EVENT_RUNAWAYSDATE_PERIODOFTHEEVENT;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSDURATIONOFTHEEVEN_DURATION = c.D_1_EVENT_RUNAWAYSDURATIONOFTHEEVEN_DURATION;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSCOUNTRYWHERETHEEV_COUNTRY = c.D_1_EVENT_RUNAWAYSCOUNTRYWHERETHEEV_COUNTRY;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSCOUNTRIESOFACCOMM_COUNTRIES = c.D_1_EVENT_RUNAWAYSCOUNTRIESOFACCOMM_COUNTRIES;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSPLACE_PERSONWHERE_PARENTS = c.D_1_EVENT_RUNAWAYSPLACE_PERSONWHERE_PARENTS;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSPLACE_PERSONWHERE_MOTHER = c.D_1_EVENT_RUNAWAYSPLACE_PERSONWHERE_MOTHER;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSPLACE_PERSONWHERE_FATHER = c.D_1_EVENT_RUNAWAYSPLACE_PERSONWHERE_FATHER;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSPLACE_PERSONWHERE_FAMILYMEMBER = c.D_1_EVENT_RUNAWAYSPLACE_PERSONWHERE_FAMILYMEMBER;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSPLACE_PERSONWHERE_FOSTERPARENTS = c.D_1_EVENT_RUNAWAYSPLACE_PERSONWHERE_FOSTERPARENTS;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSPLACE_PERSONWHERE_INSTITUTION = c.D_1_EVENT_RUNAWAYSPLACE_PERSONWHERE_INSTITUTION;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_CAR = c.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_CAR;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_BUS = c.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_BUS;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_TRAIN = c.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_TRAIN;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_BOAT = c.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_BOAT;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_AIRPLANE = c.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_AIRPLANE;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_TRUCK_CONTAINER = c.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_TRUCK_CONTAINER;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_BYFOOT = c.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_BYFOOT;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_BICYCLE = c.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_BICYCLE;
        recordToWhichToReplicate.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_MOTORBIKEORMOTORCYCLE = c.D_1_EVENT_RUNAWAYSMEANSOFTRANSPORTU_MOTORBIKEORMOTORCYCLE;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTIONBYATHIRDPERSON_ABDUCTIONBYATHIRDPERSON = c.D_1_EVENT_ABDUCTIONBYATHIRDPERSON_ABDUCTIONBYATHIRDPERSON;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONDATE_PERIODOFTHEEVENT = c.D_1_EVENT_ABDUCTI3RDPERSONDATE_PERIODOFTHEEVENT;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONDURATIONO_DURATION = c.D_1_EVENT_ABDUCTI3RDPERSONDURATIONO_DURATION;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONCOUNTRYWH_COUNTRY = c.D_1_EVENT_ABDUCTI3RDPERSONCOUNTRYWH_COUNTRY;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONCOUNTRIES_COUNTRIES = c.D_1_EVENT_ABDUCTI3RDPERSONCOUNTRIES_COUNTRIES;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONACTIVITIE_SIMPLEABDUCTION = c.D_1_EVENT_ABDUCTI3RDPERSONACTIVITIE_SIMPLEABDUCTION;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONACTIVITIE_ABDUCTIONBYFORCE_THREATOF = c.D_1_EVENT_ABDUCTI3RDPERSONACTIVITIE_ABDUCTIONBYFORCE_THREATOF;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONACTIVITIE_PUTSTHEVICTIMINDANGEROFDE = c.D_1_EVENT_ABDUCTI3RDPERSONACTIVITIE_PUTSTHEVICTIMINDANGEROFDE;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONACTIVITIE_THEACTCAUSESTHEDEATHOFTHE = c.D_1_EVENT_ABDUCTI3RDPERSONACTIVITIE_THEACTCAUSESTHEDEATHOFTHE;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONACTIVITIE_THEAUTHORENRICHESHIMSELF = c.D_1_EVENT_ABDUCTI3RDPERSONACTIVITIE_THEAUTHORENRICHESHIMSELF;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_CAR = c.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_CAR;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_BUS = c.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_BUS;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_TRAIN = c.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_TRAIN;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_BOAT = c.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_BOAT;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_AIRPLANE = c.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_AIRPLANE;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_TRUCK_CONTAINER = c.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_TRUCK_CONTAINER;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_BYFOOT = c.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_BYFOOT;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_BICYCLE = c.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_BICYCLE;
        recordToWhichToReplicate.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_MOTORBIKEORMOTORCYCLE = c.D_1_EVENT_ABDUCTI3RDPERSONMEANSOFTR_MOTORBIKEORMOTORCYCLE;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTION_PARENTALABDUCTION = c.D_1_EVENT_PARENTALABDUCTION_PARENTALABDUCTION;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTDATE_PERIODOFTHEEVENT = c.D_1_EVENT_PARENTALABDUCTDATE_PERIODOFTHEEVENT;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTDURATIONOFT_DURATION = c.D_1_EVENT_PARENTALABDUCTDURATIONOFT_DURATION;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTCOUNTRYWHER_COUNTRY = c.D_1_EVENT_PARENTALABDUCTCOUNTRYWHER_COUNTRY;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTCOUNTRIESOF_COUNTRIES = c.D_1_EVENT_PARENTALABDUCTCOUNTRIESOF_COUNTRIES;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTACTIVITIESC_SIMPLEABDUCTION = c.D_1_EVENT_PARENTALABDUCTACTIVITIESC_SIMPLEABDUCTION;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTACTIVITIESC_ABDUCTIONBYFORCE_THREATOF = c.D_1_EVENT_PARENTALABDUCTACTIVITIESC_ABDUCTIONBYFORCE_THREATOF;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTACTIVITIESC_PUTSTHEVICTIMINDANGEROFDE = c.D_1_EVENT_PARENTALABDUCTACTIVITIESC_PUTSTHEVICTIMINDANGEROFDE;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTACTIVITIESC_THEACTCAUSESTHEDEATHOFTHE = c.D_1_EVENT_PARENTALABDUCTACTIVITIESC_THEACTCAUSESTHEDEATHOFTHE;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTACTIVITIESC_THEAUTHORENRICHESHIMSELF = c.D_1_EVENT_PARENTALABDUCTACTIVITIESC_THEAUTHORENRICHESHIMSELF;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_CAR = c.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_CAR;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_BUS = c.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_BUS;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_TRAIN = c.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_TRAIN;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_BOAT = c.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_BOAT;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_AIRPLANE = c.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_AIRPLANE;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_TRUCK_CONTAINER = c.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_TRUCK_CONTAINER;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_BYFOOT = c.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_BYFOOT;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_BICYCLE = c.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_BICYCLE;
        recordToWhichToReplicate.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_MOTORBIKEORMOTORCYCLE = c.D_1_EVENT_PARENTALABDUCTMEANSOFTRAN_MOTORBIKEORMOTORCYCLE;
        recordToWhichToReplicate.D_1_EVENT_LOST_INJUREDOROTHERWISEMI_ = c.D_1_EVENT_LOST_INJUREDOROTHERWISEMI_;
        recordToWhichToReplicate.D_1_EVENT_LOSTINFUREDMISSDATE_PERIODOFTHEEVENT = c.D_1_EVENT_LOSTINFUREDMISSDATE_PERIODOFTHEEVENT;
        recordToWhichToReplicate.D_1_EVENT_LOSTINFUREDMISSDURATIONOF_DURATION = c.D_1_EVENT_LOSTINFUREDMISSDURATIONOF_DURATION;
        recordToWhichToReplicate.D_1_EVENT_LOSTINFUREDMISSCOUNTRYWHE_COUNTRY = c.D_1_EVENT_LOSTINFUREDMISSCOUNTRYWHE_COUNTRY;
        recordToWhichToReplicate.D_1_EVENT_LOSTINFUREDMISSCOUNTRIESO_COUNTRIES = c.D_1_EVENT_LOSTINFUREDMISSCOUNTRIESO_COUNTRIES;
        recordToWhichToReplicate.D_1_EVENT_PLACEWHERETHECHILDGOTLOST_CITY = c.D_1_EVENT_PLACEWHERETHECHILDGOTLOST_CITY;
        recordToWhichToReplicate.D_1_EVENT_PLACEWHERETHECHILDGOTLOST_SCHOOL = c.D_1_EVENT_PLACEWHERETHECHILDGOTLOST_SCHOOL;
        recordToWhichToReplicate.D_1_EVENT_PLACEWHERETHECHILDGOTLOST_VACATION = c.D_1_EVENT_PLACEWHERETHECHILDGOTLOST_VACATION;
        recordToWhichToReplicate.D_1_EVENT_PLACEWHERETHECHILDGOTLOST_FOREIGNCOUNTRY = c.D_1_EVENT_PLACEWHERETHECHILDGOTLOST_FOREIGNCOUNTRY;
        recordToWhichToReplicate.D_1_EVENT_PLACEWHERETHECHILDGOTLOST_YOUTHCAMP = c.D_1_EVENT_PLACEWHERETHECHILDGOTLOST_YOUTHCAMP;
        recordToWhichToReplicate.D_1_EVENT_PLACEWHERETHECHILDGOTLOST_OTHERCROWDEDPLACES = c.D_1_EVENT_PLACEWHERETHECHILDGOTLOST_OTHERCROWDEDPLACES;
        recordToWhichToReplicate.D_1_EVENT_MISSINGUNACCOMPANIEDMIGRA_MISSINGUNACCOMPANIEDMIGRA = c.D_1_EVENT_MISSINGUNACCOMPANIEDMIGRA_MISSINGUNACCOMPANIEDMIGRA;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGDATE_PERIODOFTHEEVENT = c.D_1_EVENT_MISSUNACMIGDATE_PERIODOFTHEEVENT;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGDURATIONOFTHEE_DURATION = c.D_1_EVENT_MISSUNACMIGDURATIONOFTHEE_DURATION;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGCOUNTRYOFTHEEV_COUNTRY = c.D_1_EVENT_MISSUNACMIGCOUNTRYOFTHEEV_COUNTRY;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGCOUNTRIESOFACC_COUNTRIES = c.D_1_EVENT_MISSUNACMIGCOUNTRIESOFACC_COUNTRIES;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_SEIZUREOFVICTIMSDOCUMENTS = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_SEIZUREOFVICTIMSDOCUMENTS;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_WORKPERMIT = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_WORKPERMIT;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_ASYLUMREQUEST = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_ASYLUMREQUEST;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_IDENTITYCARD = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_IDENTITYCARD;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_PASSPORT = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_PASSPORT;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_DRIVINGLICENSE = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_DRIVINGLICENSE;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_VISA = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_VISA;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_BIRTHCERTIFICATE = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_BIRTHCERTIFICATE;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_MARRIAGECERTIFICATE = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_MARRIAGECERTIFICATE;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_ORDERTOLEAVETHECOUNTRY = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_ORDERTOLEAVETHECOUNTRY;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_RESIDENCEPERMIT = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_RESIDENCEPERMIT;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_OTHER = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_OTHER;
        recordToWhichToReplicate.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_NODOCUMENTSUSED = c.D_1_EVENT_MISSUNACMIGPERSONALDOCUME_NODOCUMENTSUSED;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_USEOFFORGEDDOCUMENTS = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_USEOFFORGEDDOCUMENTS;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_WORKPERMIT = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_WORKPERMIT;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_ASYLUMREQUEST = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_ASYLUMREQUEST;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_IDENTITYCARD = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_IDENTITYCARD;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_PASSPORT = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_PASSPORT;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_DRIVINGLICENSE = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_DRIVINGLICENSE;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_VISA = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_VISA;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_BIRTHCERTIFICATE = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_BIRTHCERTIFICATE;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_MARRIAGECERTIFICATE = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_MARRIAGECERTIFICATE;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_ORDERTOLEAVETHECOUNTRY = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_ORDERTOLEAVETHECOUNTRY;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_RESIDENCEPERMIT = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_RESIDENCEPERMIT;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_OTHER = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_OTHER;
        recordToWhichToReplicate.D_1_EVENT_PERSONALDOCUMENTSFORGED_NODOCUMENTSUSED = c.D_1_EVENT_PERSONALDOCUMENTSFORGED_NODOCUMENTSUSED;
        recordToWhichToReplicate.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_TRAFFICKINGINHUMANBEINGS = c.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_TRAFFICKINGINHUMANBEINGS;
        recordToWhichToReplicate.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_RAPE = c.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_RAPE;
        recordToWhichToReplicate.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_FORGERY = c.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_FORGERY;
        recordToWhichToReplicate.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_BRIBERY = c.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_BRIBERY;
        recordToWhichToReplicate.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_KIDNAPPING = c.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_KIDNAPPING;
        recordToWhichToReplicate.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_LOCKINGUPOFPERSONS = c.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_LOCKINGUPOFPERSONS;
        recordToWhichToReplicate.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_SEXUALASSAULT = c.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_SEXUALASSAULT;
        recordToWhichToReplicate.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_SEXTOURISM = c.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_SEXTOURISM;
        recordToWhichToReplicate.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_PROSTITUTION = c.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_PROSTITUTION;
        recordToWhichToReplicate.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_PORNOGRAPHY = c.D_1_EVENT_ACTSCOMMITINTHECTXOFMISSI_PORNOGRAPHY;



        dataContext.SubmitChanges();
        myMessage += recordToWhichToReplicate.ID + " - ";
        } //foreach




      } //foreach

      if (myMessage.Length > 0)
      {
        myMessage = "Entries that have been updated - " + myMessage;
      }
      else
      {
        myMessage = "No entries have updated";
      }

      System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>");
      System.Web.HttpContext.Current.Response.Write("alert('" + myMessage + "')");
      System.Web.HttpContext.Current.Response.Write("</SCRIPT>");
    }

  }
}